package com.hxzy.service.impl;

import com.hxzy.dao.DogDao;
import com.hxzy.dao.impl.DogDaoImpl;
import com.hxzy.pojo.Dog;
import com.hxzy.service.DogService;

import java.util.Calendar;
import java.util.List;

/**
 * @author wzm
 * @create 2023-09-22 10:18
 * project_name:javaweb2308
 */
//实现DogService
public class DogServiceImpl implements DogService {
    //上调下 私有化
    private DogDao dogDao = new DogDaoImpl();

    @Override
    public boolean add(Dog dog) {
        //很多的逻辑处理代码
        int i = dogDao.insertDog(dog);//进行逻辑处理

        return i > 0;//判断
    }

    @Override
    public boolean modify(Dog dog) {
        return dogDao.updateDog(dog) > 0;
    }

    @Override
    public boolean remove(Dog dog) {
        return dogDao.deleteDog(dog) > 0;
    }

    @Override
    public Dog findById(Dog dog) {

        return dogDao.selectById(dog);
    }

    @Override
    public List<Dog> findByAll() {
        return dogDao.selectByAll();
    }
}
